package com.sanqi.work.manager.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sanqi.work.domain.WorkUser;
import com.sanqi.work.manager.IWorkUserManager;
import com.sanqi.work.mapper.WorkUserMapper;

@Component
public class WorkUserManager implements IWorkUserManager {
    @Autowired
    private WorkUserMapper workUserMapper;
    
    @Override
    public List<WorkUser> getUserByWorkplace(String workplaceId) {
        LambdaQueryWrapper<WorkUser> query = new LambdaQueryWrapper<>();
        query.eq(WorkUser::getWorkplace, workplaceId);
        return this.workUserMapper.selectList(query);
    }

    @Override
    public List<WorkUser> getAll() {
        return workUserMapper.selectList(new QueryWrapper<WorkUser>());
    }
}